<?php

#    Document   : v
#    Created on : May 6, 2011, 10:20:42 PM
#    Author     : ClarkT AKA FalleN
#    Company    : Amodity
#    Web        : http://www.amodity.com
#    Copyright  : 2011
/**

 * @property CI_Loader $load

 * @property CI_Form_validation $form_validation

 * @property CI_Input $input

 * @property CI_Email $email

 * @property CI_DB_active_record $db

 * @property CI_DB_forge $dbforge

 *  @property CI_Session $session

 * @property CI_FTP $ftp

 */

class V extends CI_Controller {

    function _remap($method) {
        $param_offset = 2;

        // Default to index
        if (!method_exists($this, $method)) {
            // We need one more param
            $param_offset = 1;
            $method = 'index';
        }

        // Since all we get is $method, load up everything else in the URI
        $params = array_slice($this->uri->rsegment_array(), $param_offset);

        // Call the determined method with all params
        call_user_func_array(array($this, $method), $params);
    }

    public function index($name) {
        $this->load->model('v_model');
        $row = $this->v_model->getimage($name);

        if (!$row) {
            $this->message->set('error', lang('g_image_missing'));
            $this->template->set('title', lang('g_image_missing'));
            $this->template->load('site_template', 'v');
        } else {
            $this->config->load('upload');
            $data['upload_path'] = substr($this->config->item('upload_path'), 2);
            $data['row'] = $row;
            $data['name'] = $name;
            $this->template->set('title', lang('g_viewing_image'). ' ' . $row->name);
            $this->template->load('site_template', 'v', $data);
        }
    }

}

?>
